/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/* 
 * File:   myplayerdemo.c
 * Author: Administrator
 *
 */

#include <stdio.h>
#include <stdlib.h>
#include "myapplist.h"
int InitFFMpeg(const char*filename);
void UnInitFFMpeg();
void TestReadFrame();
#if 0
#ifdef __MINGW32__
int WinMain(int argc,char*argv[]){
#else
int main(int argc,char*argv[]){
#endif    
#endif	
int main(int argc, char** argv) {
    int id=0;
	const char*filename = NULL;
    //no out buff
    setvbuf(stdout, NULL,_IONBF	,0);
    if(argc==1){
        return (EXIT_FAILURE);
    }
	if(argc == 3){
		filename = argv[2];
		printf("Ues Test File:%s\n",filename);
	}else {
		printf("Ues Default File\n");
	}
    id=atoi(argv[1]);
    if(id==1){
        printf("ShowBmpBySDL\n");
        ShowBmpBySDL(filename? filename:"test.bmp");//OK
    }
    if(id==2){
        printf("PlayWavBySDL\n");
        PlayWavBySDL(filename ? filename : "test.wav");//OK
    }
    if(id==3){
        printf("PlayWavByWin\n");
        PlayWavByWin(filename ? filename : "test.wav");//OK
    }
    if(id==4){
        printf("PlayYUVBySDL\n");
        PlayYUVBySDL(filename ? filename : "akiyo_352x288.yuv",352,288);//OK
    }
    if(id==5){
        printf("PlayYUVByWin\n");
        PlayYUVByWin(filename ? filename : "akiyo_352x288.yuv",352,288);//OK
    }
    if(id==6){
        printf("PlayH264BySDL\n");
        //PlayH264BySDL("test.h264");//ERR
    }
    if(id==7){
        printf("PlayFAACBySDL\n");
        //PlayFAACBySDL("test.aac");//ERR
    }
    if(id==11){
        printf("TestGetMetaData\n");
        TestGetMetaData(filename ? filename : "test.mp4");//OK
    }
    if(id==12){
        printf("TestFilterVideo\n");
        TestFilterVideo(filename ? filename : "test.mp4");//OK
    }
    if(id==13){
        printf("TestFilterAudio\n");
        TestFilterAudio(filename ? filename : "test.mp4");//OK
    }
    if(id==100){
        printf("myplayer test.mp4\n");
        myplayer(filename ? filename : "test.mp4");//OK
    }
	if (id == 101) {
		printf("myplayer test.flv\n");
		myplayer(filename ? filename : "test.flv");//OK
	}
    if(id==110){
        printf("testdemo\n");
        InitFFMpeg(filename ? filename : "test.mp4");
        TestReadFrame();
    }
	return (EXIT_SUCCESS);
}

